<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./lib/mock.js"></script>
</head>

<body>
  
  <script>
    ; (() => {
      const Random = Mock.Random
      const gen = (len) => {
        let res = []
        for (let i = 0; i < len; i++) {
          const positive = Math.random() > .8
          const o = {
            id: i + 1,
            // typeId: positive ? Random.natural(1, 9) : Random.natural(1, 20),
            // positive, //true收入 false支出
            value: Random.natural(100, 1000),
            name: Random.ctitle(3, 5),

          }
          res.push(o)
        }
        return res
      }
      console.log('gen()', gen(5))


    })();

    ; (() => {
      const Random = Mock.Random
      const gen = (len) => {
        let res = []
        for (let i = 0; i < len; i++) {
          const positive = Math.random() > .8
          const o = {
            id: i + 1,
            // typeId: positive ? Random.natural(1, 9) : Random.natural(1, 20),
            // positive, //true收入 false支出
            value: Random.natural(10, 300),
            name: Random.county()

          }
          res.push(o)
        }
        return res
      }
      console.log('gen()', gen(30))

    })();

    ; (() => {
      const Random = Mock.Random
      const gen = (len) => {
        let res = []
        const type1List = [0, 1, 2, 3, 4]
        const type2List = [0, 1]
        const type3List = [0, 1, 2, 3]
        for (let i = 0; i < type1List.length; i++) {
          for (let j = 0; j < type2List.length; j++) {
            for (let k = 0; k < type3List.length; k++) {
              const o = {
                type1: type1List[i],
                type2: type2List[j],
                type3: type3List[k],
                name: type2List[j] === 0 ? ['江岸区', '黄埔区', '洪山区', '新开区', '缅甸区', '新洲区', '武昌区', '东西湖区', '汉口区'] : ['电气工程', '自动化', '电力传动', '新能源', '动力汽车', '安全帽', '配电'],
                value: type2List[j] === 0 ? [1, 2, 3, 4, 5, 6, 7, 8, 9].map(item => Random.natural(10, 100)) : [1, 2, 3, 4, 5, 6, 7].map(item => Random.natural(10, 100)),
              }
              res.push(o)
            }
          }
        }
        return res
      }
      console.log('gen()', gen(30))

    })();
  </script>
</body>

</html>